import request from "@/request/request.ts";
import { loginFormData } from "@/views/login/interface/interface.ts";
import { loginInterface, responseUserInfoInterface } from "@/api/user/interface.ts";

enum Enum {
  login = "/admin/acl/index/login",
  userInfo = "admin/acl/index/info",
}

/* 登录的接口 */
export const loginAPI: (formData: loginFormData) => Promise<loginInterface> = (formData: loginFormData): Promise<loginInterface> => {
  return request({
    url: Enum.login,
    method: "POST",
    data: formData,
  });
};

/* 获取用户个人信息的接口 */
export const fetchUserInfoAPI: () => Promise<responseUserInfoInterface> = (): Promise<responseUserInfoInterface> => {
  return request({
    url: Enum.userInfo,
    method: "GET",
  });
};
